package com.lsh.oms.api.model.order;

import com.lsh.oms.api.model.ValidationMessage;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 订单头
 * Created by huangdong on 16/8/1.
 */
public class OrderCreateHead implements Serializable {

    private static final long serialVersionUID = 7101465560576113978L;

    /**
     * 订单类型
     */
    //type
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer orderType;

    /**
     * 订单状态
     */
    //status
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer orderStatus;

    /**
     * 区域编码
     */
    //zone_id
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer regionCode;

    /**
     * 客户编码
     */
    //uid
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Long userCode;

    /**
     * 地址编码
     */
    //address_id
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Long addressCode;

    /**
     * 省
     */
    //province
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer province;

    /**
     * 市
     */
    //city
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer city;

    /**
     * 区
     */
    //county
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer district;

    /**
     * 片区
     */
    //area
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer area;

    /**
     * 地址信息
     */
    //address_info
    @NotBlank(message = ValidationMessage.NOT_BLANK)
    private String addressInfo;

    /**
     * 商品优惠金额
     */
    //coupon_money
    @Min(value = 0, message = ValidationMessage.ERROR)
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal goodsDiscountAmout = BigDecimal.ZERO;

    /**
     * 订单折扣率
     */
    //discount_ratio
    @DecimalMin(value = "0.000001", message = ValidationMessage.ERROR)
    @DecimalMax(value = "1", message = ValidationMessage.ERROR)
    private BigDecimal orderDiscountRate = BigDecimal.ONE;

    /**
     * 订单优惠金额
     */
    //discount_coupon_money
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal orderDiscountAmout = BigDecimal.ZERO;

    /**
     * 优惠券总金额
     */
    //ticket_coupon_money
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal ticketCouponAmout = BigDecimal.ZERO;

    /**
     * 现金券总金额
     */
    //cash_coupon_money
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal cashCouponAmount = BigDecimal.ZERO;

    /**
     * 运费
     */
    //ship_money
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal freight = BigDecimal.ZERO;

    /**
     * 下单时间
     */
    //ordered_at
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Integer orderTime;

    /**
     * 抹零金额
     */
    //floor_money
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    @DecimalMax(value = "0.999999", message = ValidationMessage.ERROR)
    private BigDecimal floorAmount = BigDecimal.ZERO;

    /**
     * 支付类型（1-货到付款，2-在线支付）
     */
    //pay_type
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Range(min = 1, max = 2, message = " must be 1 or 2.")
    private Integer payType;

    /**
     * 应付金额
     */
    //money
    @NotNull(message = ValidationMessage.NOT_NULL)
    @DecimalMin(value = "0", message = ValidationMessage.ERROR)
    private BigDecimal expectPayAmount;

    /**
     * 仓储类型
     */
    //storage_type_id
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Range(min = 1, max = 2, message = " must be 1 or 2.")
    private Integer storageType;

    /**
     * 客户端IP
     */
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 0, message = ValidationMessage.ERROR)
    private Long clientIp;

    /**
     * 订单来源, 1android, 2ios, 3h5, 4pc
     */
    //from_type
    @NotNull(message = ValidationMessage.NOT_NULL)
    @Min(value = 1, message = ValidationMessage.ERROR)
    private Integer clientType;

    /**
     * 订单裸价
     */
    //origin_money
    private BigDecimal originMoney;

    /**
     * 单品特价后的总价
     */
    //saled_money
    private BigDecimal saledMoney;

    /**
     * 订单下单价(优惠后)
     */
    //placed_money
    private BigDecimal placedMoney;

    /**
     * 活动信息{["activity_id":"","activity_name":"","coupon_money":""]}
     */
    //activity_info
    private String activityInfo;

    /**
     * 优惠券信息{["coupon_id":"", "coupon_name":"", "coupon_money":""]}
     */
    //coupon_info
    private String couponInfo;

    /**
     * code
     */
    //token
    private String token;

    /**
     * 现金券信息
     */
    //cash_coupon_info
    private String cashCouponInfo;

    /**
     * 额外信息
     */
    private String ext;

    /**
     * 订单明细列表
     */
    @NotNull(message = ValidationMessage.NOT_NULL)
    private List<OrderCreateDetail> details;

    /**
     * mis订单号
     */
    @NotNull(message = ValidationMessage.NOT_NULL)
    private String misOrderNo;

    /**
     * 超市名称
     * @return
     */
    private String marketName;

    /**
     * 下单账号
     * @return
     */
    private String username;

    /**
     * 地推负责人
     * @return
     */
    private String adminName;
    
    /**
     * 是否是新用户
     * @return
     */
    private Integer isNewUser;

    /**
     * 设备id
     */
    private String deviceId;

    /**
     * log
     * @return
     */
    private String logSign;
    
    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(Integer regionCode) {
        this.regionCode = regionCode;
    }

    public Long getUserCode() {
        return userCode;
    }

    public void setUserCode(Long userCode) {
        this.userCode = userCode;
    }

    public Long getAddressCode() {
        return addressCode;
    }

    public void setAddressCode(Long addressCode) {
        this.addressCode = addressCode;
    }

    public Integer getProvince() {
        return province;
    }

    public void setProvince(Integer province) {
        this.province = province;
    }

    public Integer getCity() {
        return city;
    }

    public void setCity(Integer city) {
        this.city = city;
    }

    public Integer getDistrict() {
        return district;
    }

    public void setDistrict(Integer district) {
        this.district = district;
    }

    public Integer getArea() {
        return area;
    }

    public void setArea(Integer area) {
        this.area = area;
    }

    public String getAddressInfo() {
        return addressInfo;
    }

    public void setAddressInfo(String addressInfo) {
        this.addressInfo = addressInfo;
    }

    public BigDecimal getGoodsDiscountAmout() {
        return goodsDiscountAmout;
    }

    public void setGoodsDiscountAmout(BigDecimal goodsDiscountAmout) {
        this.goodsDiscountAmout = goodsDiscountAmout;
    }

    public BigDecimal getOrderDiscountRate() {
        return orderDiscountRate;
    }

    public void setOrderDiscountRate(BigDecimal orderDiscountRate) {
        this.orderDiscountRate = orderDiscountRate;
    }

    public BigDecimal getOrderDiscountAmout() {
        return orderDiscountAmout;
    }

    public void setOrderDiscountAmout(BigDecimal orderDiscountAmout) {
        this.orderDiscountAmout = orderDiscountAmout;
    }

    public BigDecimal getTicketCouponAmout() {
        return ticketCouponAmout;
    }

    public void setTicketCouponAmout(BigDecimal ticketCouponAmout) {
        this.ticketCouponAmout = ticketCouponAmout;
    }

    public BigDecimal getCashCouponAmount() {
        return cashCouponAmount;
    }

    public void setCashCouponAmount(BigDecimal cashCouponAmount) {
        this.cashCouponAmount = cashCouponAmount;
    }

    public BigDecimal getFreight() {
        return freight;
    }

    public void setFreight(BigDecimal freight) {
        this.freight = freight;
    }

    public Integer getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Integer orderTime) {
        this.orderTime = orderTime;
    }

    public BigDecimal getFloorAmount() {
        return floorAmount;
    }

    public void setFloorAmount(BigDecimal floorAmount) {
        this.floorAmount = floorAmount;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }

    public BigDecimal getExpectPayAmount() {
        return expectPayAmount;
    }

    public void setExpectPayAmount(BigDecimal expectPayAmount) {
        this.expectPayAmount = expectPayAmount;
    }

    public Integer getStorageType() {
        return storageType;
    }

    public void setStorageType(Integer storageType) {
        this.storageType = storageType;
    }

    public Long getClientIp() {
        return clientIp;
    }

    public void setClientIp(Long clientIp) {
        this.clientIp = clientIp;
    }

    public Integer getClientType() {
        return clientType;
    }

    public void setClientType(Integer clientType) {
        this.clientType = clientType;
    }

    public BigDecimal getOriginMoney() {
        return originMoney;
    }

    public void setOriginMoney(BigDecimal originMoney) {
        this.originMoney = originMoney;
    }

    public BigDecimal getSaledMoney() {
        return saledMoney;
    }

    public void setSaledMoney(BigDecimal saledMoney) {
        this.saledMoney = saledMoney;
    }

    public BigDecimal getPlacedMoney() {
        return placedMoney;
    }

    public void setPlacedMoney(BigDecimal placedMoney) {
        this.placedMoney = placedMoney;
    }

    public String getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(String activityInfo) {
        this.activityInfo = activityInfo;
    }

    public String getCouponInfo() {
        return couponInfo;
    }

    public void setCouponInfo(String couponInfo) {
        this.couponInfo = couponInfo;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getCashCouponInfo() {
        return cashCouponInfo;
    }

    public void setCashCouponInfo(String cashCouponInfo) {
        this.cashCouponInfo = cashCouponInfo;
    }

    public String getExt() {
        return ext;
    }

    public void setExt(String ext) {
        this.ext = ext;
    }

    public List<OrderCreateDetail> getDetails() {
        return details;
    }

    public void setDetails(List<OrderCreateDetail> details) {
        this.details = details;
    }

	public String getMisOrderNo() {
		return misOrderNo;
	}

	public void setMisOrderNo(String misOrderNo) {
		this.misOrderNo = misOrderNo;
	}

    public String getMarketName() {
        return marketName;
    }

    public void setMarketName(String marketName) {
        this.marketName = marketName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public Integer getIsNewUser() {
		return isNewUser;
	}

	public void setIsNewUser(Integer isNewUser) {
		this.isNewUser = isNewUser;
	}

    public String getLogSign() {
		return logSign;
	}

	public void setLogSign(String logSign) {
		this.logSign = logSign;
	}

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    @Override
    public String toString() {
        return "OrderCreateHead{" +
                "orderType=" + orderType +
                ", orderStatus=" + orderStatus +
                ", regionCode=" + regionCode +
                ", userCode=" + userCode +
                ", addressCode=" + addressCode +
                ", province=" + province +
                ", city=" + city +
                ", district=" + district +
                ", area=" + area +
                ", addressInfo='" + addressInfo + '\'' +
                ", goodsDiscountAmout=" + goodsDiscountAmout +
                ", orderDiscountRate=" + orderDiscountRate +
                ", orderDiscountAmout=" + orderDiscountAmout +
                ", ticketCouponAmout=" + ticketCouponAmout +
                ", cashCouponAmount=" + cashCouponAmount +
                ", freight=" + freight +
                ", orderTime=" + orderTime +
                ", floorAmount=" + floorAmount +
                ", payType=" + payType +
                ", expectPayAmount=" + expectPayAmount +
                ", storageType=" + storageType +
                ", clientIp=" + clientIp +
                ", clientType=" + clientType +
                ", originMoney=" + originMoney +
                ", saledMoney=" + saledMoney +
                ", placedMoney=" + placedMoney +
                ", activityInfo='" + activityInfo + '\'' +
                ", couponInfo='" + couponInfo + '\'' +
                ", token='" + token + '\'' +
                ", cashCouponInfo='" + cashCouponInfo + '\'' +
                ", ext='" + ext + '\'' +
                ", details=" + details +
                ", misOrderNo='" + misOrderNo + '\'' +
                ", marketName='" + marketName + '\'' +
                ", username='" + username + '\'' +
                ", adminName='" + adminName + '\'' +
                ", isNewUser='" + isNewUser + '\'' +
                '}';
    }
}
